﻿using System.Collections.Generic;

namespace RuoVea.ExDto;

/// <summary>
/// 
/// </summary>
/// <typeparam name="T"></typeparam>
public class PageResult<T>
{
    /// <summary>
    /// 页码
    /// </summary>
    public int PageNo { get; set; }
    /// <summary>
    /// 分页大小
    /// </summary>
    public int PageSize { get; set; }
    /// <summary>
    /// 共多少页
    /// </summary>
    public int TotalPage { get; set; }
    /// <summary>
    /// 总共多少行数据
    /// </summary>
    public int TotalRows { get; set; }

    /// <summary>
    /// 数据行
    /// </summary>
    public IEnumerable<T> Rows { get; set; }

    /// <summary>
    /// 初始化参数
    /// </summary>
    /// <param name="pageNo"></param>
    /// <param name="pageSize"></param>
    public PageResult(int pageNo, int pageSize)
    {
        PageNo = pageNo;
        PageSize = pageSize;
    }

    /// <summary>
    /// 初始化参数
    /// </summary>
    /// <param name="rows"></param>
    /// <param name="pageNo"></param>
    /// <param name="pageSize"></param>
    /// <param name="totalRows"></param>
    public PageResult(IEnumerable<T> rows, int pageNo, int pageSize, int totalRows)
    {
        Rows = rows;
        PageNo = pageNo;
        PageSize = pageSize;
        TotalRows = totalRows;
    }
}
